package cn.youframe.sample.transaction;

import cn.youframe.frame.base.BaseDaoImpl;

/**
 * User: Administrator
 * DateTime: 12-7-23 下午10:16
 * Desc:
 */
public class TransactionDaoImpl extends BaseDaoImpl implements TransactionDao {
    @Override
    public Object insertGetKey() {
        String sql="insert into USER_INFO(username,passwd,memo) values(?,?,?)";
        Object keyObj=insertAndGetKey(sql,new Object[]{"aaa","dddss","洒到了附近"});
        return keyObj;
    }

    @Override
    public int addMenu(String menuId, String menuName) {
        int ret=getJdbcTemplate().update("insert into mf_menu(mid,mname,memo) values (?,?,?)",new Object[]{menuId,menuName,"添加菜单"});
        return ret;
    }

    @Override
    public int updateMenu(String menuId, String menuName) {
        int ret=getJdbcTemplate().update("update mf_menu set mname=?,memo=? where mid=?",new Object[]{menuName,"添加菜单",menuId});
        return ret;
    }

    @Override
    public int deleteMenu(String menuId) {
        int ret=getJdbcTemplate().update("delete mf_menu where mid=?",menuId);
        return ret;
    }
}
